package cn.openea.perpartner.link.web.mapper;

import cn.openea.perpartner.link.web.entity.ShareLinkConfig;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * @author ysk
 * @email zane_ysk@qq.com
 * @date 2023-05-21 23:45:18
 */
@Mapper
public interface ShareLinkConfigMapper extends BaseMapper<ShareLinkConfig> {

    @Update("UPDATE component_share_link_config SET visits_num = visits_num + #{visitsNum} WHERE id = #{id}")
    void updateVisitsNum(@Param("id") Long id,@Param("visitsNum") Integer visitsNum);

    @Delete("DELETE FROM component_share_link_config WHERE share_key = #{key}")
    void updateByShareKey(@Param("key") String key);
}
